//
//  ViewTableViewCell.m
//  TFY_PlayerView
//
//  Created by 田风有 on 2019/6/28.
//  Copyright © 2019 田风有. All rights reserved.
//

#import "ViewTableViewCell.h"

@interface ViewTableViewCell ()

@property(nonatomic , strong)UIView *backView;

@property(nonatomic , strong)UILabel *name_label;
@end

@implementation ViewTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor clearColor];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        
        [self.contentView addSubview:self.backView];
        self.backView.tfy_LeftSpace(20).tfy_TopSpace(10).tfy_RightSpace(20).tfy_BottomSpace(10);
        
        [self.backView addSubview:self.name_label];
        self.name_label.tfy_LeftSpace(10).tfy_TopSpace(0).tfy_RightSpace(10).tfy_BottomSpace(0);
    }
    return self;
}

-(void)setModels:(Data *)models{
    _models = models;
    
    self.name_label.tfy_text(_models.name);
}

-(UIView *)backView{
    if (!_backView) {
        _backView = [UIView new];
        _backView.backgroundColor = [UIColor whiteColor];
        _backView.layer.shadowOffset = CGSizeMake(0, 0);
        _backView.layer.shadowRadius = 5;
        _backView.layer.shadowOpacity = 0.3;
        _backView.layer.shadowColor = [UIColor blackColor].CGColor;
        _backView.layer.cornerRadius = 15;
    }
    return _backView;
}

-(UILabel *)name_label{
    if (!_name_label) {
        _name_label = tfy_label();
        _name_label.tfy_textcolor(@"212121", 1).tfy_fontSize(14).tfy_alignment(0);
    }
    return _name_label;
}
@end
